﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CXJ.Interface;

namespace CXJ.Libiary.Cache
{
    public class ContextCache : ICache
    {
        private System.Collections.Hashtable htcache = new System.Collections.Hashtable();

        public object Get(string strkey)
        {
            if (Contains(strkey) == true)
            {
                return htcache[strkey];
            }
            else
            {
                return null;
            }
        }

        public void Add(string strkey, object objvalue)
        {
            if (Contains(strkey) == false)
            {
                htcache.Add(strkey, objvalue);
            }
        }

        public void Remove(string strkey)
        {
            if (Contains(strkey) == true)
            {
                htcache.Remove(strkey);
            }
        }

        public bool Contains(string strkey)
        {
            return htcache.Contains(strkey);
        }

        public int Count
        {
            get { return htcache.Count; }
        }

    }
}
